package fileloader
{
	import datas.GlobalDatas;
	import events.GlobalEvents;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.net.URLLoader;
	import flash.net.URLRequest;

	public class ListFile extends EventDispatcher
	{
		public static const FILE_LIST_COMPLETE:String = "filelistComplete";
		
		private var _data:XML;
		
		public function get data():XML
		{
			return _data;
		}
		
		public function ListFile()
		{
			
		}
		
		public function load():void
		{
			var request:URLRequest = new URLRequest(GlobalDatas.BASE_URL + "listfile.jsp");
			var loader:URLLoader = new URLLoader;
			loader.addEventListener(Event.COMPLETE, onLoadComplete);
			loader.load(request);
		}
		
		private function onLoadComplete(e:Event):void
		{
			_data = XML(e.target.data);
			dispatchEvent(new Event(FILE_LIST_COMPLETE));
		}

	}
}
